﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Runtime.Intrinsics.X86;

namespace Coldairarrow.Entity.Interface
{
    /// <summary>
    /// 亚马逊结算明细
    /// </summary>
    /// 

    public class SettlementDetailDTO
    {
        public string code { get; set; }
        public string msg { get; set; }
        public bool success { get; set; }
        public string traceId { get; set; }
        public SettlementDetail_List data { get; set; }

    }

    public class SettlementDetail_List
    {
        /// <summary>
        /// 总数
        /// </summary>
        public int total { get; set; }

        /// <summary>
        /// 记录列表
        /// </summary>
        public List<SettlementDetail> records { get; set; }
    }

    public class SettlementDetail
    {
        public string ID { get; set; }
        public string RowId { get; set; }

        /// <summary>
        /// 交易明细唯一标识
        /// </summary>
        public string uniqueKey { get; set; }

        /// <summary>
        /// 订单号
        /// </summary>
        public string amazonOrderId { get; set; }

        /// <summary>
        /// 店铺id
        /// </summary>
        public string sid { get; set; }
        /// <summary>
        /// 店铺名
        /// </summary>
        public string storeName { get; set; }

        /// <summary>
        /// 亚马逊店铺id	
        /// </summary>
        public string sellerId { get; set; }
        /// <summary>
        /// 国家
        /// </summary>
        public string countryCode { get; set; }
        /// <summary>
        /// 报告类型	
        /// </summary>
        public string accountType { get; set; }
        /// <summary>
        /// 配送方式	
        /// </summary>
        public string fulfillment { get; set; }
        /// <summary>
        /// 来源
        /// </summary>
        public string eventType { get; set; }

        /// <summary>
        /// MSKU
        /// </summary>
        public string sellerSku { get; set; }

        /// <summary>
        /// 交易类型
        /// </summary>
        public string type { get; set; }



        /// <summary>
        /// 结算时间	
        /// </summary>
        public string postedDateLocale { get; set; }

        /// <summary>
        /// 币种	
        /// </summary>
        public string currencyCode { get; set; }

        /// <summary>
        /// 金额	
        /// </summary>
        public string currencyAmount { get; set; }

        /// <summary>
        /// 数量	
        /// </summary>
        public string quantity { get; set; }

        /// <summary>
        /// 结算状态	
        /// </summary>
        private string _processingStatus;
        public string processingStatus 
        {
            get 
            { 
                return _processingStatus; 
            }

            set
            {
                if (value == "Open") _processingStatus = "未结算";
                else if (value == "Closed") _processingStatus = "已结算";
                else if (value == "Reconciled") _processingStatus = "已对账";
                else if (value == "Pending") _processingStatus = "待处理";
                else _processingStatus= value;
            }
        
        }

        /// <summary>
        /// 转账状态	
        /// </summary>
        private string _fundTransferStatus;
        public string fundTransferStatus
        {
            get
            {
                return _fundTransferStatus;
            }

            set
            {
                if (value == "Succeeded") _fundTransferStatus = "已转账";
                else if (value == "Processing") _fundTransferStatus = "转账中";
                else if (value == "Failed") _fundTransferStatus = "失败";
                else if (value == "Unknown") _fundTransferStatus = "未知";
                else _fundTransferStatus = value;
            }

        }

        /// <summary>
        /// 结算编号	
        /// </summary>
        public string fid { get; set; }

        /// <summary>
        /// 结算报表ID
        /// </summary>
        public string settlementId { get; set; }

        /// <summary>
        /// sku
        /// </summary>
        public string localSku { get; set; }


        /// <summary>
        /// 主键编号【非唯一键】
        /// </summary>
        public string id { get; set; }

        /// <summary>
        /// 修改时间
        /// </summary>
        public string gmtModified { get; set; }

        /// <summary>
        /// 卖方为订单定义的标识符
        /// </summary>
        public string sellerOrderId { get; set; }

        /// <summary>
        /// 市场名称
        /// </summary>
        public string marketplaceName { get; set; }

        /// <summary>
        /// SKU
        /// </summary>
        public string SKU { get; set; }



        #region 计算佣金字段
        /// <summary>
        /// 计算佣金
        /// </summary>
        public string CountCommission { get; set; }

        /// <summary>
        /// 计算佣金分组标志
        /// </summary>
        public string flag { get; set; }

        /// <summary>
        /// 主费用
        /// </summary>
        public string Principal { get; set; }
        /// <summary>
        /// 促销折扣
        /// </summary>
        public string PromotionDiscount { get; set; }
        /// <summary>
        /// 佣金
        /// </summary>
        public string Commission { get; set; }

        /// <summary>
        /// 退货主费用
        /// </summary>
        public string RetPrincipal { get; set; }
        /// <summary>
        /// 退货促销折扣
        /// </summary>
        public string RetPromotionDiscount { get; set; }
        /// <summary>
        /// 退货佣金
        /// </summary>
        public string RetCommission { get; set; }

        /// <summary>
        /// 退货佣金
        /// </summary>
        public string RetCountCommission { get; set; }

        /// <summary>
        /// 佣金率
        /// </summary>
        public string CommissionRate { get; set; }
        #endregion

    }
}
